Skip to main content

Migration Guide from LevelPlay to XMediatorAds

Integration

This section helps you migrate from the LevelPlay SDK to the XMediatorAds SDK in your Android project.


Initialize the SDK Comparison

OperationLevelPlayXMediatorAds
SDK InitializationLevelPlay.init(context, initRequest, initListener)XMediatorAds.startWith(activity = context, appKey = appKey, initSettings = initSettings, initCallback = callback)
Set User IDLevelPlayInitRequest.Builder(appKey).withUserId("user-id")UserProperties(userId = "user-id")
Set Test ModeInitSettings(test = true)
Set Extra ParamsInitSettings(userProperties = UserProperties(customProperties = ...))

For more details, refer to:


Ad Formats

OperationLevelPlayXMediator
ConfigadConfig = new LevelPlayBannerAdView.Config.Builder().build();final Banner.Size size = Banner.Size.Phone
Set ListenerbannerView.setListener(listener)XMediatorAds.Banner.addListener(listener)
Create BanneradView = LevelPlayBannerView(context, adUnitId, adConfig)XMediatorAds.Banner.create(placementId, size)
Show BannerbannerView.visibility = View.VISIBLEcontainer.addView(XMediatorAds.Banner.getView(placementId))
Destroy/RemovebannerView.destroy()XMediatorAds.Banner.removeListener(listener) or remove the view from the container
Manual RefreshbannerView.loadAd()XMediatorAds.Banner.load(placementId)
Set Ad SpaceXMediatorAds.Banner.setAdSpace(placementId, "ad-space")
Event / ActionLevelPlay (LevelPlayBannerAdViewListener)XMediator (BannerAds.Listener)
Ad LoadedonAdLoaded(adInfo: LevelPlayAdInfo)onLoaded(placementId: String, loadResult: LoadResult)
Load FailedonAdLoadFailed(error: LevelPlayAdError)
Ad DisplayedonAdDisplayed(adInfo: LevelPlayAdInfo)
Display FailedonAdDisplayFailed(adInfo: LevelPlayAdInfo, error: LevelPlayAdError)
ClickedonAdClicked(adInfo: LevelPlayAdInfo)onClicked(placementId: String)
ExpandedonAdExpanded(adInfo: LevelPlayAdInfo)
CollapsedonAdCollapsed(adInfo: LevelPlayAdInfo)
Left ApplicationonAdLeftApplication(adInfo: LevelPlayAdInfo)
ImpressiononImpression(placementId: String, impressionData: ImpressionData)

Key Differences: Banner Ads

FeatureLevelPlayXMediator
Banner CreationLevelPlayBannerAdView(context, adUnitId, adConfig)XMediatorAds.Banner.create(placementId, size)
Banner SizesPhone, Tablet, Mrec, AdaptivePhone, Tablet, Mrec
Show BannerSet view visibleAdd view to container
Impression CallbackNot available by defaultExplicit callback per placement
Listener InterfaceLevelPlayBannerViewAdListenerBannerListener
Ad IdentifiersAd Unit IDPlacement ID
Retry LogicManualAutomatic (SDK handles retries)

For more details, refer to: X3M Banner LevelPlay Banner


Interstitial Ads

Interstitial API Method Comparison

OperationLevelPlayXMediator
Set ListenerinterstitialAd.setListener(listener)XMediatorAds.Interstitial.addListener(listener)
Load InterstitialinterstitialAd.loadAd()XMediatorAds.Interstitial.load(placementId)
Check ReadyinterstitialAd.isReady()XMediatorAds.Interstitial.isReady() or isReady(placementId)
Show InterstitialinterstitialAd.show()XMediatorAds.Interstitial.show(activity, "ad-space") or .show(placementId, activity, "ad-space")
Destroy/RemoveinterstitialAd.destroy()XMediatorAds.Interstitial.removeListener(listener = interstitialListener)

Listener Method Comparison

Event / ActionLevelPlay (LevelPlayInterstitialAdListener)XMediator (InterstitialAds.Listener)
LoadedonAdLoaded(levelPlayAdInfo: LevelPlayAdInfo)onLoaded(placementId, loadResult)
Load FailedonAdLoadFailed(levelPlayAdError: LevelPlayAdError)
DisplayedonAdDisplayed(levelPlayAdInfo: LevelPlayAdInfo)onShowed(placementId)
Display FailedonAdDisplayFailed(levelPlayAdError: LevelPlayAdError, levelPlayAdInfo: LevelPlayAdInfo)onFailedToShow(placementId, showError)
ClickedonAdClicked(levelPlayAdInfo: LevelPlayAdInfo)onClicked(placementId)
ClosedonAdClosed(levelPlayAdInfo: LevelPlayAdInfo)onDismissed(placementId)
ImpressiononImpression(placementId, impressionData)

Key Differences: Interstitial Ads

FeatureLevelPlayXMediator
Impression CallbackOn displayExplicit callback per placement
Listener InterfaceLevelPlayInterstitialAdListenerInterstitialListener
Ad IdentifiersAd Unit IDPlacement ID
Retry LogicManualAutomatic (SDK handles retries)

For more details, refer to: X3M Interstitial LevelPlay Interstitial


Rewarded Ads

Rewarded API Method Comparison

OperationLevelPlayXMediator
Set ListenerrewardedAd.setListener(listener)XMediatorAds.Rewarded.addListener(listener)
Load RewardedrewardedAd.loadAd()XMediatorAds.Rewarded.load(placementId)
Check ReadyrewardedAd.isReady()XMediatorAds.Rewarded.isReady() or isReady(placementId)
Show RewardedrewardedAd.show()XMediatorAds.Rewarded.show(activity, "ad-space") or .show(placementId, activity, "ad-space")
Destroy/RemoverewardedAd.destroy()XMediatorAds.Rewarded.removeListener(listener = rewardedListener)

Listener Method Comparison

Event / ActionLevelPlay (LevelPlayRewardedAdListener)XMediator (RewardedAds.Listener)
LoadedonAdLoaded(adInfo: LevelPlayAdInfo)onLoaded(placementId: String, loadResult: LoadResult)
Load FailedonAdLoadFailed(error: LevelPlayAdError)
DisplayedonAdDisplayed(adInfo: LevelPlayAdInfo)onShowed(placementId: String)
Display FailedonAdDisplayFailed(error: LevelPlayAdError, adInfo: LevelPlayAdInfo)onFailedToShow(placementId: String, showError: ShowError)
ClickedonAdClicked(adInfo: LevelPlayAdInfo)onClicked(placementId: String)
ClosedonAdClosed(adInfo: LevelPlayAdInfo)onDismissed(placementId: String)
RewardedonAdRewarded(reward: LevelPlayReward, adInfo: LevelPlayAdInfo)onEarnedReward(placementId: String)
ImpressiononImpression(placementId: String, impressionData: ImpressionData)
Ad Info ChangedonAdInfoChanged(adInfo: LevelPlayAdInfo)

Key Differences: Rewarded Ads

FeatureLevelPlayXMediator
Reward CallbackonUserRewarded(ad, reward)onEarnedReward(placementId)
Impression CallbackOn displayExplicit callback per placement
Listener InterfaceLevelPlayRewardedAdListenerRewardedAds.Listener
Ad IdentifiersAd Unit IDPlacement ID
Retry LogicManualAutomatic (SDK handles retries)
Auto-load/Auto-retryManualAutomatic after dismiss/fail
Auto-load/Auto-retryManualAutomatic after dismiss/fail

For more details, refer to: X3M Rewarded LevelPlay Rewarded